<?php
$page = Yii::app()->getRequest()->getParam('Issue_page') ? Yii::app()->getRequest()->getParam('Issue_page') : 1;$this->breadcrumbs=array(
    Yii::t('site','Issues')=>array('admin','Issue_page'=>$page),
    $model->recordName,
    Yii::t('site','View'),
);

$this->menu=array(
    array('label'=>Yii::t('site','Item'),'items'=>array(
        array('label'=>Yii::t('site','Update Issue'), 'url'=>array('update', 'id'=>$model->id,'Issue_page'=>$page)),
        array('label'=>Yii::t('site','Delete Issue'), 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id,'Issue_page'=>$page),'confirm'=>'Are you sure you want to delete this item?')),
    )),
    array('label'=>Yii::t('site','All Items'),'items'=>array(
        array('label'=>Yii::t('site','Create New Issue'), 'url'=>array('create','Issue_page'=>$page)),
        array('label'=>Yii::t('site','Manage Issues'), 'url'=>array('admin','Issue_page'=>$page)),
    )),
);
?>

<h1><?php echo Yii::t('site','View Issue <em>{recordName}</em>',array('{recordName}'=>$model->recordName)); ?></h1>

<?php $this->widget('zii.widgets.CDetailView', array(
    'data'=>$model,
    'attributes'=>array(
        'id',
        array(
            'name'=>'projectId',
            'type'=>'raw',
            'value'=>CHtml::link($model->project->recordName,array('/project/view','id'=>$model->projectId)),
        ),
        'ownerId',
        'summary',
        array(
            'name'=>'description',
            'type'=>'raw',
            'value'=>nl2br($model->description),
        ),
        array(
            'name'=>'issueType',
            'value'=>$model->issueTypeOptions[$model->issueType],
        ),
        array(
            'name'=>'issueStatus',
            'value'=>$model->swGetStatus()->getLabel(),
        ),
        'priority',
        array(
            'name'=>'milestoneId',
            'type'=>'raw',
            'value'=>!is_null($model->milestone) ? CHtml::link($model->milestone->recordName,array('/milestone/view','id'=>$model->milestoneId)) : Yii::t('site','(Not set)'),
        ),
        'tags',
        array(
            'name'=>'isChargeable',
            'type'=>'raw',
        ),
        'hoursSpent',
        array(
            'name'=>'tsCreated',
            'type'=>'raw',
            'value'=>Yii::app()->dateFormatter->formatDateTime($model->tsCreated,'medium','short'),
        ),
        array(
            'name'=>'userIdCreated',
            'type'=>'raw',
            'value'=>$model->createdBy->recordName
        ),
        array(
            'name'=>'tsUpdated',
            'type'=>'raw',
            'value'=>$model->tsUpdated!=null ? Yii::app()->dateFormatter->formatDateTime($model->tsUpdated,'medium','short') : '-',
            'visible' => !is_null($model->tsUpdated),
        ),
        array(
            'name'=>'userIdUpdated',
            'type'=>'raw',
            'value'=>$model->updatedBy->recordName,
            'visible' => !is_null($model->userIdUpdated),
        ),
    ),
)); ?>

<div id="comments" style="margin-top: 30px">
    <?php if($model->commentCount>=1): ?>
    <h3>
        <?php echo Yii::t('site','1#One Comment|n>1#{numComments} Comments',array($model->commentCount,'{numComments}'=>$model->commentCount)); ?>
    </h3>

    <?php $this->renderPartial('_comments',array(
        'issue'=>$model,
        'comments'=>$model->comments,
    )); ?>
    <?php endif; ?>

    <h4><?php echo CHtml::encode(Yii::t('site','Leave a Comment')); ?></h4>

    <?php $this->renderPartial('/issueComment/_form',array(
        'model'=>$comment,
    )); ?>

</div><!-- comments -->
